package code.tools.commponents
{
	import flash.display.BitmapData;
	import flash.filters.GlowFilter;
	import flash.geom.Matrix;
	import flash.text.StyleSheet;

	public class Style
	{
		public static const fontName:String                 = "宋体";
		public static const fontSize:Number                 = 12;

		///////////////////////////////////
		// LABEL
		///////////////////////////////////
		public static const COLOR_LABEL_TEXT:uint           = 0xC3946A;
		public static const COLOR_LABEL_TEXT_HOVER:uint     = 0xFEE1A0;
		/**
		 * 用于某些特殊文字的突出作用
		 */
		public static const COLOR_LABEL_TEXT_IMPORTANT:uint = 0xd3a902;
		/**
		 * 购买金额大于所持金额的情况使用红色文字
		 */
		public static const COLOR_PRICE_OUT_RANGE:uint      = 0xff0000;

		/**
		 * 得到价格文字的颜色
		 * 判断是否有能力购买
		 */
		public static function getPriceColor(price:uint , own:int):uint
		{
			return price > own ? COLOR_PRICE_OUT_RANGE:COLOR_LABEL_TEXT;
		}
		///////////////////////////////////
		// BUTTON
		///////////////////////////////////
		public static const COLOR_BUTTON_LABEL:uint         = 0xffffff;//0xeccb80;
//		public static const COLOR_BUTTON_LABEL_HOVER:uint= 0xc1a046;
		///////////////////////////////////
		// inputText
		///////////////////////////////////
		public static const COLOR_INPUT_TEXT:uint           = COLOR_LABEL_TEXT_HOVER;

		public static const COLOR_PANEL_TITLE_LABEL:uint    = 0xC8960D;
		///////////////////////////////////
		// TIP
		///////////////////////////////////
		/**
		 * 气泡提示
		 */
		public static const COLOR_TIP_BG:uint               = 0xFFCE00;

//		public static var hoverfilter:Array = [new GlowFilter(0xEABA00 , 1.8 , 8 , 5)];
		///////////////////////////////////
		// hover filter
		///////////////////////////////////
		public static var HOVER_FILTERS:Array               = [new GlowFilter(0x9f9f78 , 1.8 , 8 , 5)];
		///////////////////////////////////
		// other
		///////////////////////////////////
		/**
		 * html text的css样式
		 * link 普通状态样式
		 * hover 鼠标悬停样式
		 */
		public static var navigateSheet:StyleSheet          = new StyleSheet;
		navigateSheet.parseCSS('a:hover {color: #FEE1A0; font-size: 14; text-decoration:underline} ' +
		'a:link {color: #FEE1A0; font-size: 14; text-decoration:none;}');

		public static var CHECKBOX_BG:uint   = 0xCEBA82;
		public static var CHECKBOX_FACE:uint = 0xE87005;
		public static var BACKGROUND:uint    = 0xCCCCCC;
		public static var INPUT_TEXT:uint    = 0x333333;
		public static var DROPSHADOW:uint    = 0x000000;
		public static var PANEL:uint         = 0xF3F3F3;

		private static const matrix:Matrix   = new Matrix();

		public static function getFilpBmd(source:BitmapData , sx:Number = 1 , sy:Number = 1):BitmapData
		{
			var bmd:BitmapData = new BitmapData(source.width , source.height , source.transparent , 0);
			matrix.identity();
			matrix.scale(sx , sy);
			matrix.translate(sx < 0 ? -source.width * sx : 0 , sy < 0 ? -source.height * sy : 0);
			bmd.draw(source , matrix);
			return bmd;
		}
	}
}
